import {observable,action} from 'mobx';
import {getVoteList,sendselect} from '../../services/vote';
import {SendSelect} from '../../types/vote.d';


export default class Vote{
    @observable voteList = [];

    //获取投票列表
    @action
    getVoteList = async () => {
       let res =  await getVoteList();
       this.voteList = res.data.data.lists
    }

    //投票
    @action
    sendselect = async (params:SendSelect) => {
        let res  = await sendselect(params);
        console.log(res);
        await this.getVoteList()
    }
}